import request from '@/utils/request.js'

// 用户登录
export function authorizations (data) {
  return request({
    method: 'post',
    url: '/v1_0/authorizations',
    data: data
  })
}

// 获取用户信息
export function userProfile () {
  return request({
    url: '/v1_0/user/profile'
  })
}

// 获取频道列表
export function channels () {
  return request({
    url: '/v1_0/channels'
  })
}

// 获取文章列表
export function mpArticles (params) {
  return request({
    url: '/v1_0/mp/articles',
    params: params
  })
}

// 发表文章
export function mpArticlesPost (bol, data) {
  return request({
    method: 'post',
    url: '/v1_0/mp/articles',
    params: {
      draft: bol
    },
    data: data
  })
}

// 删除文章
export function mpArticlesDelete (id) {
  return request({
    method: 'delete',
    url: '/v1_0/mp/articles/' + id
  })
}

// 获取文章详情
export function mpArticlesGet (id) {
  return request({
    url: '/v1_0/mp/articles/' + id
  })
}

// 编辑文章
export function mpArticlesPut (bol, data) {
  return request({
    method: 'put',
    url: '/v1_0/mp/articles/' + data.id,
    params: {
      draft: bol
    },
    data: data
  })
}
